package day7.homework3;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        StudentBiz biz = new StudentBiz();
        System.out.print("请输入要创建的学生数：");
        int count = input.nextInt();
        // 初始化数组
        biz.init(count);
        for (int i = 0; i < count; i++) {
            Student student = new Student();
            System.out.print("请输入第" + (i + 1) + "学生的姓名:");
            student.setName(input.next());
            System.out.print("请输入第" + (i + 1) + "学生的年龄:");
            student.setAge(input.nextInt());
            System.out.print("请输入第" + (i + 1) + "学生的学号:");
            student.setStudentId(input.nextInt());
            biz.add(student);
        }
        biz.print();
        System.out.println("总共创建学生数量为:" + Student.totalStudents);
        System.out.print("请输入要查找的学生姓名:");
        String name = input.next();
        Student searchStudent = biz.search(name);
        if(searchStudent == null) {
            System.out.println("查无此人");
        } else {
            System.out.println(searchStudent);
        }
    }
}
